<?php
namespace app\servercertificate\model;

use \app\manage\model\BaseModel;

class Certificate extends BaseModel
{
	protected $name = 'certificate';
    protected $connection = 'db_config_certificate';
    protected $dateFormat = 'Y-m-d H:i:s';
    protected $statusText = [ 0=>'待审核',1=>'审核通过', 2=>'审核失败', 3=>'作废' ];
    protected $isPublicText = [0=>'指定应用', 1=>'公共应用'];
    protected $typeText = ['advanced'=>'高级证书', 'common'=>'普通证书'];
    protected $isPickText = [0=>'否', 1=>'是'];
    protected $isRecommendText = [0=>'否', 1=>'是'];
    protected $applyInvalidText = [0=>'否', 1=>'是'];
    protected $isTransferText = [0=>'', 1=>'转让中'];
    protected $append = ['status_text','type_text','is_pick_text','is_recommend_text','apply_invalid_text','is_transfer_text'];
    
    public function setGoodsInfoAttr($value)
    {
        return json_encode($value);
    }
   
    public function getGoodsInfoAttr($value)
    {
        return json_decode($value);
    }

    public function setOrderInfoAttr($value)
    {
        return json_encode($value);
    }
   
    public function getOrderInfoAttr($value)
    {
        return json_decode($value);
    }

    public function setTransferLogAttr($value)
    {
        return json_encode($value);
    }
   
    public function getTransferLogAttr($value)
    {
        return json_decode($value);
    }

    public function getIsPublicTextAttr($value, $data)
    {
        return $this->isPublicText[$data['is_public']];
    }

    public function getTypeTextAttr($value, $data)
    {
        return $this->typeText[$data['type']];
    }

    public function getIsPickTextAttr($value, $data)
    {
        return $this->isPickText[$data['is_pick']];
    }

    public function getIsRecommendTextAttr($value, $data)
    {
        return $this->isRecommendText[$data['is_recommend']];
    }

    public function getApplyInvalidTextAttr($value, $data)
    {
        return $this->applyInvalidText[$data['apply_invalid']];
    }

    public function getIsTransferTextAttr($value, $data)
    {
        return $this->isTransferText[$data['is_transfer']];
    }

  
}